<?php
@session_start();
$selfpagearr=explode("/",$_SERVER["PHP_SELF"]);
$pagename=$selfpagearr[count($selfpagearr)-1];
if(!strstr($pagename,".php"))
{
    $pagename="index.php";
}
extract($_POST);

require_once "lib/config.php";
require_once "lib/functions.php";
require_once "lib/pdomanager.php";
require_once "lib/paginate_class.php";

$pdodbobj=new DB();
$pdodbobj->dbname=DBNAME;
$pdodbobj->hostname=HOST;
$pdodbobj->dbusername=USERNAME;
$pdodbobj->dbpassword=PASSWORD;
$pdodbobj->dbtype=TYPE;
$pdodbobj->portnumber=PORTNUMBER;

$fileobj=$pdodbobj->connect();

if(isset($_SESSION['Allyfolio_User_ID']) && $_SESSION['Allyfolio_User_ID']!="")
{
    $insertarr=array("User_ID"=>$_SESSION['Allyfolio_User_ID']);
    $insertarr["Status"]="Logout";
    $insertarr["logtime"]=time();
    
    $pdodbobj->insertData("af_user_loginout_log",$insertarr);
    
    $updatearr=array("Login_Status"=>"Logout");
    $conditionarr=array("User_ID"=>$_SESSION['Allyfolio_User_ID']);
    
    $pdodbobj->updateData("af_users",$updatearr,$conditionarr);
    
    setcookie("Allyfolio_User",$_SESSION['Allyfolio_User_ID'],time()-86400);
    $_SESSION['Allyfolio_User_ID']="";
    unset($_SESSION['Allyfolio_User_ID']);
    setcookie("Allyfolio_offset",$_SESSION['Allyfolio_offset'],time()-86400);
    $_SESSION['Allyfolio_offset']="";
    unset($_SESSION['Allyfolio_offset']);
    
}
require_once("includes/pagetop.php");

?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>AllyFolio | Logout </title>
<link href="css/style.css" rel="stylesheet" type="text/css" media="all"  />
</head>

<body>

	<div id="main_wrapper">
    <?php
    //$pageheading="Logout";
    require_once("includes/header.php");
    ?>
    <!--=================Body Contain Start=======================-->
    <div class="wrapper">
    	<div class="header">
    		<div class="logout_banner">
            	<p>You've signed out of Allyfolio.Thanks for visiting......</p>
            </div>
            
            <div class="logout_ads">
            	<ul>
                	<li><a href="#"><img src="images/ads_1.jpg" alt=" Ads" width="320" height="247"   /></a></li>
                  <li><a href="#"><img src="images/ads_2.jpg" alt="Ads" width="320" height="247"  /></a></li>
                  <li><a href="#"><img src="images/ads_3.jpg" alt="Ads" width="320" height="247"  /></a></li>
                </ul>
            </div>
		</div>
    </div>
    
    <div class="clearfix"></div>
    <!--=================Body Contain end=======================-->
    </div>
<?php
    require_once("includes/footer.php");
?>    